package com.artifact.mit.mypoint.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.artifact.mit.mypoint.R;
import com.artifact.mit.mypoint.service.model.PointConnector;

public class PointConnectorAdapter extends ArrayAdapter<PointConnector> {
	
	public PointConnectorAdapter(Context context) {
		super(context, 0);
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(getContext()).inflate(R.layout.point_connector_row_item, null);
		}
		
		ImageView imageView = (ImageView) convertView.findViewById(R.id.imageView1);
		TextView title = (TextView) convertView.findViewById(R.id.textView1);
		TextView desc = (TextView) convertView.findViewById(R.id.textView2);

		imageView.setImageResource(getItem(position).img);
		title.setText(getItem(position).title);
		desc.setText(getItem(position).desc);
		return convertView;
	}

}
